<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Teams extends CI_Model {

    
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
        
    function getAllTeam()
    {
        $query = $this->db->get_where('ss_team', array('enabled' => 1));
        
        return $query->result();
    }

    function get_team($teamid){
    	
    	$query = $this->db->get_where('ss_team', array('teamid' => $teamid));
    	
    	return $query->result();
    	
    }

    function create_team($logo,$name,$country,$type,$enabled)
    {
    	$this->team_logo = $logo;
    	$this->team_name = $name; // please read the below note
    	$this->team_country = $country;
    	$this->team_type = $type;
    	$this->enabled = $enabled;
    	$this->create_date = date("Y-m-d H:i:s");
    
    	$this->db->insert('ss_team', $this);
    }
    
    function edit_team($teamid,$logo,$name,$country,$type,$enabled)
    {
    	
    	$this->team_name   = $name;
    	$this->team_logo = $logo;
    	$this->team_country = $country;
    	$this->team_type   = $type;
    	$this->enabled = $enabled;
    
    	$this->db->update('ss_team', $this, array('teamid' => $teamid));
    }
    
    function delete_team($teamid){
    	$this->db->delete('ss_team', array('teamid' => $teamid));
    }
    
    /*function insert_entry()
    {
        $this->title   = $_POST['title']; // please read the below note
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->insert('entries', $this);
    }

    function update_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }
*/
}